<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <title>管理后台</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
        <!-- 新 Bootstrap 核心 CSS 文件 -->
        <link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">

        <!-- 可选的Bootstrap主题文件（一般不用引入） -->
        <link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">

        <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
        <script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>

        <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
        <script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
        <link href="Public/admin/css/signin.css" rel="stylesheet">
    </head>
    <body onkeydown="if(event.keyCode==13){document.getElementById('login').click();return false;}">
        <div class="container">

      <form name="dosubmit" id="dosubmit" role="form" method="post" class="form-signin">
          <input type="hidden" name="action" value="login" />
        <h2 class="form-signin-heading">管理后台</h2>
        <label for="inputEmail" class="sr-only">用户名</label>
        <input type="text" id="inputEmail" class="form-control" placeholder="用户名" name="username" required autofocus>
        <label for="inputPassword" class="sr-only">Password</label>
        <input type="password" id="inputPassword" class="form-control" name="password" placeholder="密码" required>
        <!--<div class="checkbox">
          <label>
            <input type="checkbox" value="remember-me"> Remember me
          </label>
        </div>-->
        <!--<input type="submit" value="登录" class="btn btn-lg btn-primary btn-block submit"/>-->
        <button class="btn btn-lg btn-primary btn-block submit" type="button" id="login">登录</button>
      </form>

    </div> <!-- /container -->

    </body>
    <script>
        
        $(".submit").click(function(){
            if ($("input[name='mob']").val()=='') {
                alert('请输入正确的用户名/手机号');
                return;
            }
            if ($("input[name='password']").val()=='') {
                alert('请输入密码');
                return;
            }
            $.ajax({
                cache: true,
                type: "POST",
                url:"?m=Center&c=Login",
                data:$('#dosubmit').serialize(),// 序列号formid
                async: false,
                dataType: 'json',
                error: function(request) {
                    
                },
                success: function(data) {
                    console.log(data);
                    if (data.error == 0) {
//                        $('.modal-body').html('添加成功！');
                        window.location.href="?m=Center&c=Admin&a=main";
                    }else{
                        alert(data.msg);
                    }
                },
                beforeSend: function(){
                    
                },
               complete: function(){
                   
                }
            });
        });
        
    </script>
</html>
